<template>
  <div style="width: 100%">
    <!---->
    <el-form :inline="true" status-icon label-position="right" class="demo-form-inline"
             label-width="110px" style="padding-top: 20px;">
      <el-form-item label="开始日期：">
        <el-date-picker
          v-model="listQuery.startDate"
          type="date"
          placeholder="开始日期"
          value-format="yyyy-MM-dd">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="结束日期：">
        <el-date-picker
          v-model="listQuery.endDate"
          type="date"
          placeholder="结束日期"
          value-format="yyyy-MM-dd">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="公司名称：">
        <!--<el-input v-model="listQuery.unicode" placeholder="统一信用代码"/>-->
        <el-select v-model="listQuery.unicode" placeholder="请选择" style="width: 110%;">
          <el-option
            v-for="item in companys"
            :key="item.unicode"
            :label="item.companyName"
            :value="item.unicode"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item style=" margin-left: 30px">
        <el-button class="filter-item" type="primary" @click="getList">查询</el-button>
      </el-form-item>

      <!-- 查询结果 -->
      <el-table v-loading="listLoading" :data="list" element-loading-text="正在查询中。。。" border fit highlight-current-row
                :header-cell-style="{background:'#F2F2F2',color:'#666'}" height="410">
        <el-table-column align="left" min-width="140" label="公司名称" prop="companyName"/>
        <el-table-column align="left" min-width="120" label="票据号" prop="billNo"/>
        <el-table-column align="left" min-width="120" label="贴现利息 (元)" prop="discountPer"/>
        <el-table-column align="left" min-width="100" label="票据金额 (元)" prop="amount"/>
        <el-table-column align="left" min-width="120" label="贴现日期" prop="discountDate"/>
        <el-table-column align="left" min-width="100" label="贴现银行费用" prop="cost"/>
      </el-table>
      <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize"
                  @pagination="getList" style="margin: 0;padding: 10px 16px"/>
    </el-form>

  </div>
</template>

<script>
import {doGet, doPost} from '@/api'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination

export default {
  name: 'realcheck',
  filters: { },
  components: {
    Pagination
  },
  data() {
    return {
      list: [],
      companys: [],
      total: 0,
      listQuery: {
        pageNum: 1,
        pageSize: 10,
        unicode: undefined,
        startDate: undefined,
        endDate: undefined
      },
      listLoading: true,
    }
  },
  created() {
    this.getList()
    doGet('personal.html?op=compinfo', {}).then(response => {
      this.companys = response.rows
    }).catch(() => {
      this.companys = []
    })
  },
  methods: {
    getList() {
      this.listLoading = true
      doGet('recordsearch.html?op=search', this.listQuery).then(response => {
        this.list = response.rows
        this.total = response.data.totalcount
        this.listLoading = false
      }).catch(() => {
        this.list = []
        this.total = 0
        this.listLoading = false
      })
    },
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
</style>
